package com.dex4d.api;

import com.dex4d.model.HttpResult;
import com.dex4d.model.MarketPriceModel;
import com.dex4d.model.RequestMapParam;
import com.dex4d.model.RequestParam;
import com.dex4d.model.RequestParamObj;
import com.dex4d.model.TokenModel;
import com.dex4d.ui.main.model.AccountCoin;
import com.dex4d.ui.main.model.AccountCoinJson;
import com.dex4d.ui.main.model.Dex4dResult;
import com.dex4d.ui.main.model.TokenContract;
import com.dex4d.ui.main.model.TokenGame;
import com.dex4d.ui.main.model.TradeToken;
import com.dex4d.ui.qr.model.QRRequest;
import com.dex4d.ui.qr.model.QRResult;
import com.dex4d.ui.wallet.model.TxReceipt;
import com.dex4d.ui.wallet.model.WalletTx;
import com.dex4d.update.AppUpdate;

import java.util.List;

import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Url;
import rx.Observable;


public interface Dex4dApi {

    @FormUrlEncoded
    @POST("/user/sendVerifyCode")
    Observable<HttpResult> sendVerifyCode(@Field("phone") String phone);

    @FormUrlEncoded
    @POST("/uaa/oauth/token?grant_type=password")
    Observable<TokenModel> login(@Field("username") String username, @Field("password") String password);

    @POST("/")
    Observable<HttpResult<String>> requestByParam(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<String>> requestByMapParam(@Body RequestMapParam requestMapParam);

    @POST("/")
    Observable<HttpResult<Boolean>> checkName(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<MarketPriceModel>> requestMarketPrice(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<AccountCoinJson>> gatewayVaultOverview(@Body RequestParamObj requestParam);

    @POST("/")
    Observable<HttpResult<AccountCoin>> gatewayMainVaultOverview(@Body RequestParamObj requestParam);

    @POST("/")
    Observable<HttpResult<Dex4dResult<TradeToken>>> getMarketCapInfo(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<String>> calculateTokensReceived(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<String>> calculateBuyTokenSpend(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<List<TokenContract>>> getTokenTables(@Body RequestParam requestParam);

    @POST("/")
    Observable<HttpResult<List<TokenGame>>> getGamesByTokenName(@Body RequestParam requestParam);

    @GET
    @Headers({"Content-Type:application/json;charset=UTF-8"})
    Observable<QRResult> QRLogin(@Url String url);

    @POST
    Observable<QRResult> QRLoginConfirm(@Url String url, @Body QRRequest request);

    @POST
    Observable<QRResult> QRPayConfirm(@Url String url, @Body QRRequest request);

    @GET
    @Headers({"Content-Type:application/json;charset=UTF-8"})
    Observable<QRResult> QRPay(@Url String url);

    @POST
    Observable<String> addtx(@Url String url, @Body WalletTx tx);

    @POST
    Observable<TxReceipt> gettxsinfo(@Url String url, @Body TxReceipt tx);

    @GET
    @Headers({"Content-Type:application/json;charset=UTF-8"})
    Observable<AppUpdate> updateInfo(@Url String url);

    @GET
    @Headers({"Content-Type:application/json;charset=UTF-8"})
    Observable<String> parseInfo(@Url String url);
}
